home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: news.inap.net!news1!basmith1
- From: basmith@iquest.net (Brian Smith)
- Subject: Borland gettextinfo and textcolor (in conio.h)
- X-Nntp-Posting-Host: ind-015-238-68.iquest.net
- Message-ID: <4jvh92$118_001@basmith1.iquest.net>
- Summary: Need help using these two together
- Keywords: gettextinfo textcolor
- Sender: news@iquest.net (News Admin)
- Organization: IDT
- X-Newsreader: News Xpress Version 1.0 Beta #4
- Date: Thu, 4 Apr 1996 03:50:42 GMT
-
- I'm trying to blank out several "cells" (x-y coordinates) on a text screen. My
- approach is:
- 1. gettextinfo(&TextInfo); //Use gettextinfo from conio.h to retrieve all the
- current text mode settings and store them into a structure called TextInfo.
- 2. OldTextColor = TextInfo.attribute // save the current text color for later
- use, in a variable called OldTextColor (an unsigned char, just like in the
- structure of TextInfo.)
- 3. textcolor(TextInfo.normattr) // set text color to background color
- 4. putch(219) // everywhere I want blanked out. (219 is the big rectangle
- ASCII character)
- 5. textcolor(OldTextColor); // to set the text color back to where it was.
-
- The problem is that no matter what I do, step 3 sets the text color to light
- gray, which happens to be represented by the integer 7, the highest integer
- you can use for a background color.
-
- I have an idea why this happens, but am not experienced enough to quite figure
- it out; all the elements in the TextInfo structure (as defined by conio.h in
- the gettextinfo function) are unsigned characters, but the parameters
- that's passed to textcolor is an integer. So I think the problem is that
- the color (normattr) is stored in TextInfo as an unsigned char, but I need
- it to be an int before I can pass it as a parameter to textcolor. I've tried
- casting these elements as int (textcolor((int)TextInfo.normattr), but it makes
- no difference.
-
- Any help w/b greatly appreciated.
-
- brian smith
- (new guy w/ one resolution for '96; LEARN C!!)
-
-